package com.iti.jets.gpts.home;

// default package
// Generated Mar 22, 2014 9:41:00 PM by Hibernate Tools 3.4.0.CR1

import com.iti.jets.gpts.dao.AbstractDAO;
import com.iti.jets.gpts.pojo.AttributeType;
import com.iti.jets.gpts.pojo.TranService;
import com.iti.jets.gpts.pojo.TranServiceAttribute;
import java.util.List;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;

/**
 * Home object for domain model class TranServiceAttribute.
 *
 * @see .TranServiceAttribute
 * @author Hibernate Tools
 */
public class TranServiceAttributeHome extends AbstractDAO<TranServiceAttribute> {

    public TranServiceAttributeHome(SessionFactory sessionFactory) {
        super(sessionFactory);
    }

    public List<TranServiceAttribute>
            getTranServiceAttributes(TranService tranService) {
        return session.createCriteria(entityClass)
                .add(Restrictions.eq("tranService", tranService))
                .list();
    }

    public List<TranService>
            getTranServicesByAttribute(
                    AttributeType attributeType,
                    String value) {
                return session.createCriteria(entityClass)
                        .add(Restrictions.eq("value", value))
                        .setProjection(Projections.groupProperty("tranService"))
                        .list();
            }
}
